Contains: Apple Speech Recognition Toolbox Interfaces.
Version: Technology: PlainTalk 1.5
Release: PlainTalk Developer Release
Copyright: ⌐ 1984-1995 by Apple Computer, Inc.
All rights reserved.
Bugs?: If you find a problem with this file, send the file and version
information (from above) and the problem description to:
Internet: apple.bugs@applelink.apple.com
AppleLink: APPLE.BUGS
*/
#ifndef __SPEECHRECOGNITION__
#define __SPEECHRECOGNITION__
#ifndef __MEMORY__
#include <Memory.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif
#if PRAGMA_IMPORT_SUPPORTED
#pragma import on
#endif
enum {
gestaltSpeechRecognitionVersion = 'srtb',
gestaltSpeechRecognitionAttr = 'srta'
};
enum {
gestaltDesktopSpeechRecognition = 1L << 0,
gestaltTelephoneSpeechRecognition = 1L << 1
};
/* Error Codes [Speech recognition gets -5100 through -5199] */
enum {
eSRNotAvailable = -5100, /* the service requested is not avail or applicable */
eSRInternalError = -5101, /* a system internal or hardware error condition */
eSRComponentNotFound = -5102, /* a needed system resource was not located */
eSROutOfMemory = -5103, /* an out of memory error occurred in the toolbox memory space */
eSRNotASpeechObject = -5104, /* the object specified is no longer or never was valid */
eSRBadParameter = -5105, /* an invalid parameter was specified */
eSRParamOutOfRange = -5106, /* when we say 0-100, don't pass in 101. */
eSRBadSelector = -5107, /* an unrecognized selector was specified */
eSRBufferTooSmall = -5108, /* returned from attribute access functions */
eSRNotARecSystem = -5109, /* the object used was not a RecognitionSystem */
eSRFeedbackNotAvail = -5110, /* there is no feedback window associated with Recognizer */
eSRCantSetProperty = -5111, /* a non-settable property was specified */
eSRCantGetProperty = -5112, /* a non-gettable property was specified */
eSRCantSetDuringRecognition = -5113, /* the property can't be set while recognition is in progress -- do before or between utterances. */
eSRAlreadyListening = -5114, /* in response to SRStartListening */
eSRNotListeningState = -5115, /* in response to SRStopListening */
eSRModelMismatch = -5116, /* no acoustical models are avail to match request */
eSRNoClientLanguageModel = -5117, /* trying to access a non-specified LanguageModel */
eSRNoPendingUtterances = -5118, /* nothing to continue search on */
eSRRecognitionCanceled = -5119, /* an abort error occurred during search */
eSRRecognitionDone = -5120, /* search has finished, but nothing was recognized */
eSROtherRecAlreadyModal = -5121, /* another recognizer is modal at the moment, so can't set this recognizer's kBlockModally property right now */
eSRHasNoSubItems = -5122, /* SRCountItems or related routine was called on an object without subelements -- e.g. a word -- rather than phrase, path, or LM. */
eSRSubItemNotFound = -5123, /* returned when accessing a non-existent sub item of a container */
eSRLanguageModelTooBig = -5124, /* Cant build language models so big */
eSRAlreadyReleased = -5125, /* this object has already been released before */
eSRAlreadyFinished = -5126, /* the language model can't be finished twice */
eSRWordNotFound = -5127, /* the spelling couldn't be found in lookup(s) */
eSRNotFinishedWithRejection = -5128, /* property not found because the LMObj is not finished with rejection */
eSRExpansionTooDeep = -5129, /* Language model is left recursive or is embedded too many levels */
eSRTooManyElements = -5130, /* Too many elements added to phrase or path or other langauge model object */
eSRCantAdd = -5131, /* Can't add given type of object to the base LanguageObject (e.g.in SRAddLanguageObject) */
eSRSndInSourceDisconnected = -5132, /* Sound input source is disconnected */
eSRCantReadLanguageObject = -5133, /* An error while trying to create new Language object from file or pointer -- possibly bad format */
/* non-release debugging error codes are included here */
eSRNotImplementedYet = -5199 /* you'd better wait for this feature in a future release */
};
/* Type Definitions */
typedef unsigned long SpeechObject;
typedef SpeechObject RecognitionSystem;
typedef SpeechObject Recognizer;
typedef SpeechObject SpeechSource;
typedef SpeechSource RecognitionResult;
typedef SpeechObject LanguageObject;
typedef LanguageObject LanguageModel;
typedef LanguageObject LMPath;
typedef LanguageObject LMPhrase;
typedef LanguageObject LMWord;
typedef unsigned long LMFlags;
/* between 0 and 100 */
typedef unsigned short SpeedSetting;
/* between 0 and 100 */
typedef unsigned short RejectionLevel;
/* When an event occurs, the user supplied proc will be called with a pointer */
/* to the param passed in and a flag to indicate conditions such */
/* as interrupt time or system background time. */
struct SRCallBackStruct {
long what; /* one of notification flags */
long message; /* contains RecognitionResult id */
Recognizer instance; /* ID of recognizer being notified */
OSErr status; /* result status of last search */
short flags; /* non-zero if occurs during interrupt */
long refCon; /* user defined - set from SRCallBackParam */
kNotifyRecognitionBeginning = 1L << 0, /* recognition can begin. client must now call SRContinueRecognition or SRCancelRecognition */
kNotifyRecognitionDone = 1L << 1 /* recognition has terminated. result (if any) is available. */
};
/* Apple Event selectors */
/* AppleEvent message class */
enum {
kAESpeechSuite = 'sprc'
};
/* AppleEvent message event ids */
enum {
kAESpeechDone = 'srsd',
kAESpeechDetected = 'srbd'
};
/* AppleEvent Parameter ids */
enum {
keyRecognizer = 'krec',
keySpeechResult = 'kspr',
keySpeechStatus = 'ksst'
};
/* AppleEvent Parameter types */
enum {
typeRecognizer = 'trec',
typeSpeechResult = 'tspr'
};
/* Recognizer Properties */
enum {
kSearchStatusParam = 'stat', /* see status flags below */
kNotificationParam = 'noti', /* see notification flags below */
kCallBackParam = 'call', /* type SRCallBackParam */
kAutoFinishingParam = 'afin', /* automatic finishing applied on LM for search */
kForegroundOnly = 'fgon', /* Boolean. Default is true. If true, client recognizer only active when in foreground. */
kBlockBackground = 'blbg', /* Boolean. Default is false. If true, when client recognizer in foreground, rest of LMs are inactive. */
kBlockModally = 'blmd', /* Boolean. Default is false. When true, this client's LM is only active LM; all other LMs are inactive. Be nice, don't be modal for long periods! */
kWantsResultTextDrawn = 'txfb', /* Boolean. Default is true. If true, search results are posted to Feedback window */
kWantsAutoFBGestures = 'dfbr', /* Boolean. Default is true. If true, client needn't call SRProcessBegin/End to get default feedback behavior */
kSoundInVolume = 'volu', /* short in [0..100] log scaled sound input power. Can't set this property */
kReadAudioFSSpec = 'aurd', /* *FSSpec. Specify FSSpec where raw audio is to be read (AIFF format) using kCannedDesktopSpeechSource. Reads until EOF */
kCancelOnSoundOut = 'caso', /* Boolean: Default is true. If any sound is played out during utterance, recognition is aborted. */
kSpeedVsAccuracyParam = 'sped' /* SpeedSetting between 0 and 100 */
};
/* 0 means more accurate but slower. */
/* 100 means (much) less accurate but faster. */
enum {
kUseToggleListen = 0, /* listen key modes */
kUsePushToTalk = 1
};
enum {
kListenKeyMode = 'lkmd', /* short: either kUseToggleListen or kUsePushToTalk */
kListenKeyCombo = 'lkey', /* short: Push-To-Talk key combination; high byte is high byte of event->modifiers, the low byte is the keycode from event->message */
kOptional = 'optl', /* Boolean -- true if LanguageObject is optional */
kRepeatable = 'rptb', /* Boolean -- true if LanguageObject is repeatable */
kRejectable = 'rjbl', /* Boolean -- true if LanguageObject is rejectable (Recognition System's kRejectedWord */
/* object can be returned in place of LanguageObject with this property) */
kPrimitive = 'prim', /* Boolean -- determines what shows up in search result's list of primitives */
kRejectionLevel = 'rjct', /* RejectionLevel between 0 and 100 */
kFinishingFlags = 'finf' /* Please use kOptional, kRepeatable, and kRejetable instead. pass pointer to LMFlags. Being phased out of public interfaces. */
};
/* LM Object Types -- returned as kLMObjType property of language model objects */
enum {
kLMType = 'lmob', /* LanguageModel */
kPathType = 'path', /* LMPath */
kPhraseType = 'phra', /* LMPhrase */
kWordType = 'word' /* LMWord */
};
/* a normal and reasonable rejection level */
enum {
kDefaultLMRejectionLevel = 50
};
/* Finishing Flags - used to make up LMFlags, which is used for kFinishingFlags and kAutoFinishingParam properties */
/* 4/10/95 These finishing flags are being phased out of the public interfaces. Please use kOptional, kRepeatable, */
/* and kRejectable Boolean LanguageObject properties instead. Those Boolean properties are easier to use. */
enum {
/* bit zero is reserved */
kAddPauses = 1L << 1, /* allows user to pause between words */
kAddRejection = 1L << 2, /* unrecognized words will be rejected */
kAddNoise = 1L << 3, /* allows a some noise at beginning or end of utterance */
kMakeOptional = 1L << 4, /* contents of LM are optional */
kMakeRepeatable = 1L << 5 /* contents of LM may be repeated 0 or more times */